/*  1:   */ package org.jetbrains.generate.tostring.config;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.generate.tostring.psi.PsiAdapter;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */ 
/* 10:   */ public class InsertLastStrategy
/* 11:   */   implements InsertNewMethodStrategy
/* 12:   */ {
/* 13:31 */   private static final InsertLastStrategy a = new InsertLastStrategy();
/* 14:   */   
/* 15:   */   public static InsertLastStrategy getInstance()
/* 16:   */   {
/* 17:36 */     return a;
/* 18:   */   }
/* 19:   */   
/* 20:   */   public PsiMethod insertNewMethod(PsiClass paramPsiClass, @NotNull PsiMethod paramPsiMethod, Editor paramEditor)
/* 21:   */   {
/* 22:42 */     if (paramPsiMethod == null) {
/* 23:42 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/generate/tostring/config/InsertLastStrategy", "insertNewMethod" }));
/* 24:   */     }
/* 25:42 */     PsiMethod localPsiMethod = PsiAdapter.findPublicStaticVoidMainMethod(paramPsiClass);
/* 26:43 */     if (localPsiMethod != null)
/* 27:   */     {
/* 28:45 */       localObject = paramPsiClass.getMethods();
/* 29:46 */       if (localPsiMethod.equals(localObject[(localObject.length - 1)])) {
/* 30:47 */         return (PsiMethod)paramPsiClass.addBefore(paramPsiMethod, localPsiMethod);
/* 31:   */       }
/* 32:   */     }
/* 33:52 */     Object localObject = paramPsiClass.getRBrace();
/* 34:53 */     return (PsiMethod)paramPsiClass.addBefore(paramPsiMethod, (PsiElement)localObject);
/* 35:   */   }
/* 36:   */   
/* 37:   */   public String toString()
/* 38:   */   {
/* 39:57 */     return "Last";
/* 40:   */   }
/* 41:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.generate.tostring.config.InsertLastStrategy

 * JD-Core Version:    0.7.0.1

 */